using System;

using System.ComponentModel;

using System.Web.UI;
using System.Web.UI.WebControls;

namespace SBPweb.Controls.Web
{
	/// <summary>
	/// This class is the extension of the Button. It provides an AlternatingCssClass property which is used
	/// when te mouse moves over the control.
	/// </summary>
	[Description("Special button that can use a different Style sheet when the mouse moves over it")]
	[ToolboxData("<{0}:DesignButton runat=server></{0}:DesignButton>")]
	public class DesignButton : Button
	{

		#region Private fields

		private string mCssClass2;

		#endregion

		#region Public Properties

		/// <summary>
		/// Gets or sets the CssClass to use when the mouse moves over the Control
		/// </summary>
		[Bindable(true)]
		[Category("Appearance")]
		[Description("The css used when the mouse moves over the Control")]
		public string AlternatingCssClass
		{
			get
			{
				return mCssClass2;
			}
			set
			{
				mCssClass2 = value;
			}
		}

		#endregion

		#region Overrided Methods

		/// <summary>
		/// Sets the CssClass for mousevoer and mouseout
		/// </summary>
		/// <param name="e"></param>
		protected override void OnPreRender(EventArgs e)
		{
			base.OnPreRender(e);
			Attributes.Add("onmouseover", "this.className = '" + AlternatingCssClass + "';");
			Attributes.Add("onmouseout", "this.className = '" + CssClass + "';");
		}

		#endregion

	}
}
